# library(tidyverse) # metapackage with lots of helpful functions
library(knitr)
library(repr)
bike_data <- read.csv("metro-bike-share-trip-data.csv") # read csv file
# data
# help(read.csv)
head(bike_data)
typeof(bike_data)
cols <- colnames(bike_data)
print(cols)
bike_data$Duration_Mins = bike_data$Duration/60
cols <- colnames(bike_data)
print(cols)
library(ggplot2)
ggplot(data = bike_data, aes( x = Duration_Mins) ) +
geom_bar(fill = "lightblue", colour = "black")
ggplot(data = bike_data, aes( x = Trip.Route.Category) ) +
geom_bar(fill = "lightblue", colour = "black")
ggplot(data = bike_data, aes( x = Passholder.Type) ) +
geom_bar(fill = "lightblue", colour = "black")
library(devtools) install_github("dkahle/ggmap")
library(ggmap)
library(mapproj)
library(dplyr)
library(forcats)
register_google(key = "AIzaSyBiC7HYahM49Hh4_tvdnKQtjh7Ho6bGdew", day_limit = 1000)
ggmap_credentials()
map <- get_map(location = 'Los Angeles', zoom = 14)
# ggmap(map)
? geom_point
p <- ggmap(map)
p + geom_point(data=bike_data, aes(x=Starting.Station.Longitude, y=Starting.Station.Latitude), color="red", size=0.5, alpha=0.7)
p + geom_point(data=bike_data, aes(x=Ending.Station.Longitude, y=Ending.Station.Latitude), color="yellow", size=0.5, alpha=0.7)
p <- ggmap(map)
p + geom_density2d(data = bike_data, aes(x = Starting.Station.Longitude, y = Starting.Station.Latitude))
# stat_density2d(data = W, aes(x = lon, y = lat), size = 0.01, bins = 16, geom = 'polygon') +
scale_fill_gradient(low = "green", high = "red") +
scale_alpha(range = c(0.00, 0.25), guide = FALSE) +
theme(legend.position = "none", axis.title = element_blank(), text = element_text(size = 12))
(starting_point[1])
for (col in cols){
print(col)
ggplot(data = bike_data, aes( x = bike_data)) +
geom_bar(fill = "lightblue", colour = "black")
}